package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.NursingProjectDTO;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectVO;
import org.apache.ibatis.annotations.*;

/**
 * 护理模块的持久层
 */
@Mapper
public interface NursingProjectMapper {
    /**
     * 分页查询
     * @param nursingProject
     * @return
     */
    Page<NursingProjectVO> list(NursingProject nursingProject);

    /**
     * 新增护理
     * @param nursingProject
     */
    @Insert("insert into nursing_project (id, name, order_no, unit, price, image, nursing_requirement, status, create_by, update_by, remark, create_time, update_time)" +
            "values (#{id}, #{name}, #{orderNo}, #{unit}, #{price}, #{image}, #{nursingRequirement}, #{status}, #{createBy}, #{updateBy}, #{remark}, #{createTime}, #{updateTime})")
    void add(NursingProject nursingProject);

    /**
     * 根据id查询护理
     * @param id
     * @return
     */
    @Select("select * from nursing_project where id =#{id}")
    NursingProject getByIdWithNursing(Integer id);

    /**
     * 修改护理
     * @param nursingProject
     */
    void updateNursing(NursingProject nursingProject);

    void changeStatusById(Integer id, Integer status);

    @Delete("delete from nursing_project where id=#{id};")
    void deleteById(Integer id);

    @Update("update nursing_project set status = #{status} where id=#{id}")
    void startOrStop(Integer id, Integer status);
}
